@include('admin.common.header')

<!--tab nav start-->
<section class="panel">
    <header class="panel-heading tab-bg-dark-navy-blue ">
        <ul class="nav nav-tabs">
            <li @if ($_active['_action'] == 'list')  class="active" @endif>
                <a href="/admin/personInfo">个人中心详情</a>
            </li>
            <li @if ($_active['_action'] == 'listpoint')  class="active" @endif>
                <a href="/admin/personInfo/point">返现管理</a>
            </li>

        </ul>
    </header>
    <div class="panel-body">
        <div class="tab-content">
            <div class="row cmxform form-horizontal tasi-form">
                <div class="col-lg-6">
                    <section class="panel">
                        <div class="panel-body">

                            <div class="form-group ">
                                <label for="name" class="control-label col-lg-2">返现金额</label>
                                <div class="col-lg-10">
                                    <input class="form-control form-item" name="id" placeholder="" value="" type="hidden" />
                                    <input class="form-control form-item" name="money"  placeholder="" value="" type="text" />
                                </div>
                            </div>

                            <div class="form-group ">
                                <label for="name" class="control-label col-lg-2">返现时间</label>
                                <div class="col-lg-10">
                                    <input class="form-control form-item" id="cash_at" name="cash_at"  placeholder="" value="" type="text" />
                                </div>
                            </div>

                            <div class="form-group ">
                                <label for="name" class="control-label col-lg-2">返现比率</label>
                                <div class="col-lg-10">
                                    <input class="form-control form-item" name="cash_ratio" placeholder="" value="" type="text" />
                                </div>
                            </div>
                        </div>

                    </section>
                </div>
                <div class="col-lg-6">

                </div>
            </div>
            <div class="col-lg-12 text-center">
                <button class="btn btn-danger form-submitaaa" >返现编辑</button>
            </div>
        </div>
    </div>
</section>
<!--tab nav start-->

<script>
    require([ 'libs/layDate-v5.0.9/laydate/laydate'] , function (layerDate) {
        layerDate.render({
            elem: '#cash_at'
            ,type: 'datetime'
        });


    });


    $('.form-submitaaa').bind('click', function () {
        var id =$("input[name='id']").val();
        var addpoints =$("input[name='addpoints']").val();
        var points =Number($("input[name='addpoints']").val())+Number($("input[name='presentPoints']").val());
        $.ajax({
            type: 'post',
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            url: '/admin/personInfo/edit',
            data: {id:id,points:points,addpoints:addpoints},
            dataType: 'json',
            success: function(){
                layer.msg('添加成功');
                window.location.reload();
            }
        });
    });
</script>

@include('admin.common.footer')